package ar.uade.edu.fain.ad.client.web.servlet;

import java.io.IOException;

import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import ar.uade.edu.fain.ad.client.delegate.DelegateFactory;
import ar.uade.edu.fain.ad.client.web.util.WebUtils;

public abstract class BaseServlet extends HttpServlet {

	private static final long serialVersionUID = 1L;

	public BaseServlet() {
		super();
	}

	protected abstract String getViewBasePath();

	protected void forward(String view, HttpServletRequest request,
			HttpServletResponse response) throws ServletException, IOException {
		final RequestDispatcher dispatcher = getServletContext()
				.getRequestDispatcher(view);
		dispatcher.forward(request, response);
	}

	protected DelegateFactory getDelegateFactory() {
		return WebUtils.get().getDelegateFactory();
	}
	
}
